package dao.impl;

import dao.StaffDao;
import entity.Staff;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import utils.DruidUtils;

import java.util.List;

public class StaffDaoImpl implements StaffDao {
    private JdbcTemplate jdbcTemplate = new JdbcTemplate(DruidUtils.getDataSource());
    @Override
    public List<Staff> selectAllStaffs() {
        String sql = "select* from staff";
        List<Staff> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Staff.class));
        return query;
    }
}
